package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ArithmeticPlusOperatorContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ArithmeticStarExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.ArithmeticPlusMinusExpressionContext;

/**
 * 算术加减语法遍历
 * 
 * @author zwd
 *
 */
public class ArithmeticPlusMinusExpressionVisitor
		extends AbsCQLParserBaseVisitor<ArithmeticPlusMinusExpressionContext> {

	private ArithmeticPlusMinusExpressionContext context = null;

	public ArithmeticPlusMinusExpressionVisitor() {
		context = new ArithmeticPlusMinusExpressionContext();
	}

	@Override
	protected ArithmeticPlusMinusExpressionContext defaultResult() {
		return context;
	}

	@Override
	public ArithmeticPlusMinusExpressionContext visitArithmeticStarExpression(@NotNull ArithmeticStarExpressionContext ctx) {
		ArithmeticStarExpressionVisitor visitor = new ArithmeticStarExpressionVisitor();
		context.getStarExpressions().add(visitor.visit(ctx));
		return context;
	}
	
	@Override
	public ArithmeticPlusMinusExpressionContext visitArithmeticPlusOperator(@NotNull ArithmeticPlusOperatorContext ctx) {
		context.getOperator().add(ctx.getText());
        return context;
	}

}
